#ifndef WG_LOADING_HPP
#define WG_LOADING_HPP

#include "qt_api.hpp"
#include "sgt_style.hpp"

#define USER_CANCEL -1

class WgLoading : public QDialog
{
    Q_OBJECT
public:
    WgLoading(QWidget* parent = nullptr);
    ~WgLoading();
    void set_txt_tips(const QString txt);
    void enable_cancel(const bool enable = true);
    void move_center(QWidget* parent);
protected:
    void paintEvent(QPaintEvent* event) override;
Q_SIGNALS:
    void cancel_waiting();
private slots:
    void btn_cancel_clicked();
private:
    QFrame* frame_center;
    QLabel* movie_label;
    QMovie* movie_loading;
    QLabel* label_tips;
    QPushButton* btn_cancel;

    void init_ui();
};
#endif
